package com.flin.icesilkworm.examination.bas.controller;

import javax.validation.Valid;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.flin.icesilkworm.framework.pojos.ResultMessage;
import com.flin.icesilkworm.framework.spring.annotation.SmcController;
import com.flin.icesilkworm.framework.spring.auth.Auth;
import com.flin.icesilkworm.examination.bas.form.TheExamineeTrainingForm;
import com.flin.icesilkworm.examination.bas.model.TheExamineeTraining;
import com.flin.icesilkworm.examination.gen.bas.controller.GeneratedTheExamineeTrainingController;

@SmcController
@Auth(authCode = "smc_bas_TheExamineeTraining", authDesc = "训练题目", ctrl = true)
@RequestMapping("/smc/bas/TheExamineeTraining")
public class TheExamineeTrainingController extends GeneratedTheExamineeTrainingController {

	 /**
		* Description:
		*     生成"训练题目"
		* AccessUrl:
		*     /addTheExamineeTraining.do
		* Parameters:
		*     t : 训练题目对象
		* Return:    
		*	  json:{success:false,message:''}
		* History: 
		*     1.00  auto_time  sybris   Creation
		* Example:
		*/
	@Auth(authCode="buildTraing",authDesc="生成'训练题目'",ctrl=true)
	@RequestMapping("/buildTraing.do")
	public @ResponseBody ResultMessage buildTraing(@RequestBody @Valid TheExamineeTrainingForm f){

		return success("生成训练题",theExamineeTrainingService.buildTraing(f.getExamTrainId()));
	}
	
	
	/**
	* Description:
	*     生成'强化训练'
	* AccessUrl:
	*     /addTheExamineeTraining.do
	* Parameters:
	*     t : 训练题目对象
	* Return:    
	*	  json:{success:false,message:''}
	* History: 
	*     1.00  auto_time  sybris   Creation
	* Example:
	*/
	@Auth(authCode="buildReinforcement",authDesc="生成'强化训练'",ctrl=true)
	@RequestMapping("/buildReinforcement.do")
	public @ResponseBody ResultMessage buildReinforcement(@RequestBody @Valid TheExamineeTrainingForm f){
	
		return success("强化训练",theExamineeTrainingService.buildReinforcement(f.getExamTrainId()));
	}
	
	
	/**
	* Description:
	*     记录训练结果
	* AccessUrl:
	*     /addTheExamineeTraining.do
	* Parameters:
	*     t : 训练题目对象
	* Return:    
	*	  json:{success:false,message:''}
	* History: 
	*     1.00  auto_time  sybris   Creation
	* Example:
	*/
	@Auth(authCode="logTraingInfo",authDesc="记录训练结果",ctrl=true) 
	@RequestMapping("/logTraingInfo.do")
	public @ResponseBody ResultMessage logTraingInfo(@RequestBody @Valid TheExamineeTrainingForm f){
		
		return success("",theExamineeTrainingService.logTraingInfo(f.getExamTrainId(),f.getRecordInfo()));
	}
	
}